import requests
import time
time = int(time.time()*1000)

for page in range(1,100):


    url = (f"https://api.bilibili.com/x/web-interface/wbi/index/top/feed/rcmd?"
           f"web_location=1430650&"
           f"y_num=4&"
           f"fresh_type=3"
           f"&feed_version=V8&"
           f"fresh_idx_1h=6&"
           f"fetch_row=1&"
           f"fresh_idx={page}&"
           f"brush=6&"
           f"device=win&"
           f"homepage_ver=1&"
           f"ps=30&"
           f"last_y_num=4&"
           f"screen=1056-794&"
           f"seo_info=&tt_exp=&"
           f"last_showlist=av_115422263249617,av_115451287836097,av_115325374832033,av_115438721834820,av_n_115311667845980,av_n_115451371722086,av_n_115231707635522,av_n_115425081822996,av_n_115456438508074,av_n_115399563674350%3Blogin_card_undefined,av_115381628899301,av_115455566026642,av_115152955380942,av_n_115451841483422,av_n_115331028819895,av_n_115308798935464,av_n_115308564058197,av_n_115435114602495,av_n_115457730284173&uniq_id=533927836504&"
           f"w_rid=26bc9868fe328c8c069df406741b6f4a&"
           f"wts=time"
           )
    header = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.64"
    }

    response = requests.get(url,headers=header)

    items = response.json()["data"]['item']
    for item in items:
        print(item.get("title"))

    print(len(items))
